import time

from selenium import webdriver
from selenium.webdriver.common.by import By
# 初始化driver
driver = webdriver.Chrome()
# 打开指定网页
driver.get("https://www.baidu.com/")
# 设置隐式等待
driver.implicitly_wait(15)
# 全屏
driver.maximize_window()
# 定位到设置
driver.find_element(By.ID,"s-usersetting-top").click()
# 点击搜索设置
driver.find_elements(By.CLASS_NAME,"set")[0].click()
# 点击保存设置
driver.find_element(By.CLASS_NAME,"prefpanelgo").click()
time.sleep(5)
# 弹窗处理alert
alert = driver.switch_to.alert
# 点击弹窗中的确定
alert.accept()
# 点击弹窗中的取消
# alert.dismiss()

time.sleep(5)
